<template>
  <div id="app">
    <h2>我是根组件，数据：{{ name }}---{{ price }}</h2>
    <Child/>
  </div>
</template>

<script>
import { ref, reactive, toRefs,provide } from "vue";
import Child from "./components/Child.vue";
export default {
  name: "App",
  components: {
    Child
  },
  setup(props) {
    const car = reactive({name: "奔驰",price: "40W"});
    // 祖组件通过provide提供数据
    provide('car',car)

    return {
      ...toRefs(car),
    };
  },
};
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 10px;
  background: orange;
}
</style>
